// Defines a subtractionquestion
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chalmers.se.tda367.question;

/**
 *
 * @author Hanna
 */
public class SubtractionMathQuestion extends MathQuestion {

    public SubtractionMathQuestion(int maxX, int maxY) { // the parameters are the maximum values that an be assigned to x and y
        int x = 1 + (int) (maxX * Math.random()); // randomizes the x-value
        int y = 1 + (int) (maxY * Math.random()); // randomizes the y-value
        answer = x - y;
        question = x + " - " + y;

        if (answer < 0) {                 // makes sure that the answer can't be negative if the parameters are positive
            answer = y - x;
            question = y + " - " + x;
        }
    }
}
